The Derivation of Functional Equivalents of Imperative Programs
نویسنده
چکیده
Denotational semantics is presented as a valuable theoretical tool, having many applications including language design, compiler generation and program analysis. In particular, a method is described for deriving a concise and useful functional representation of a program using a denotational definition of the source language’s semantics. Our aim is to translate a given program into a compact functional representation to facilitate its evaluation on functional hardware. The A-expressions are first translated into Turner’s combinator code (see [7]). We choose to use a fuced set of combinators as the resulting code is more amenable to analysis and there are many inherent advantages such as lazy evaluation and once only evaluation of reducible sub-expressions. Semantic algebras relating to static semantics and the store algebra are “unfrozen” so they can be partially evaluated. The reduction machine that performs the evaluation includes simplification rules that allows a more compact functional representation (denotation) to be reached. r f desired, some or all of the programs arguments can be supplied to produce a new denotation (result) using the same reduction machine.
منابع مشابه
Beyond Fun: Order and Membership in Polytypic Imperative Programming
We argue that the category of transformers of monotonic predicates on posets is superior to the category of transformers on pow-ersets, as the basis for a calculus of higher order imperative programming. We show by an example polytypic program derivation that such transformers (and the underlying categories of order-compatible relations and monotonic functions) model a calculus quite similar to...
متن کاملDeriving the Aho-Corasick Algorithms: A Case Study into the Synergy of Programming Methods
Imperative programs can be derived using methods like stepwise reenement, but they do not lend themselves very well to transformational programming. The Bird-Meertens approach ooers a powerful transformation calculus for functional programs, but it pays little or no attention to imperative algorithms. In this paper we will show how the two approaches can be combined by giving a transformational...
متن کاملPointer Program Derivation Using Coq: Graphs and Schorr-Waite Algorithm
We present a specification, a derivation and total correctness proofs of operations for bi-functional graphs implemented with pointers, including the Schorr-Waite algorithm. This one marks such a graph with an economical depth-first strategy. Our approach is purely algebraic and functional, from a simple graph specification to the simulation of a tailrecursive imperative program, then to a true...
متن کاملRelational Programming Laws in the Tree, List, Bag, Set Hierarchy
In this paper we demonstrate that the basic rules and calculational techniques used in two extensively documented program derivation methods can be expressed, and, indeed, can be generalised within a relational theory of datatypes. The two methods to which we refer are the so-called “Bird-Meertens formalism” for the construction of functional programs and the “Dijkstra-Feijen calculus” for the ...
متن کاملBuilding an IDE for the Calculational Derivation of Imperative Programs
In this paper, we describe an IDE called CAPS (Calculational Assistant for Programming from Specifications) for the interactive, calculational derivation of imperative programs. In building CAPS, our aim has been to make the IDE accessible to non-experts while retaining the overall flavor of the pen-and-paper calculational style. We discuss the overall architecture of the CAPS system, the main ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2001